import * as os from 'os';
const networkInterface = os.networkInterfaces();

let localIp: string = "";
Object.keys(networkInterface).forEach((interfaceName) => {
	const interfaces: { [key: string]: any } = networkInterface[interfaceName] as object;

	interfaces.some((iface: { [key: string]: any }) => {
		if (iface.family === 'IPv4' && !iface.internal) {
			localIp = iface.address;
			return true;
		}

		return false;
	});
});

console.log(localIp);
